package org.foj.builder;

import org.foj.model.Issue;

import java.util.Date;

/**
 * @author jeremy anderson
 */
public class IssueBuilder {

  private Long id = 1L;
  private String project = "project";
  private String description = "description";
  private String type = "type";
  private String severity = "severity";
  private String status = "status";
  private String details = "details";
  private String reportedBy = "reportedBy";
  private Date reportedOn = new Date();
  private String assignedTo = "assignedTo";
  private Double estimatedHours = 0.0;

  public IssueBuilder withId(Long id) {
    this.id = id;
    return this;
  }

  public IssueBuilder withProject(String project) {
    this.project = project;
    return this;
  }

  public IssueBuilder withDescription(String description) {
    this.description = description;
    return this;
  }

  public IssueBuilder withType(String type) {
    this.type = type;
    return this;
  }

  public IssueBuilder withSeverity(String severity) {
    this.severity = severity;
    return this;
  }

  public IssueBuilder withStatus(String status) {
    this.status = status;
    return this;
  }

  public IssueBuilder withDetails(String details) {
    this.details = details;
    return this;
  }

  public IssueBuilder withReportedBy(String reportedBy) {
    this.reportedBy = reportedBy;
    return this;
  }

  public IssueBuilder withReportedOn(Date reportedOn) {
    this.reportedOn = reportedOn;
    return this;
  }

  public IssueBuilder withAssignedTo(String assignedTo) {
    this.assignedTo = assignedTo;
    return this;
  }

  public IssueBuilder withEstimatedHours(Double estimatedHours) {
    this.estimatedHours = estimatedHours;
    return this;
  }

  public Issue build() {
    Issue issue = new Issue();

    issue.setId(id);
    issue.setProject(project);
    issue.setDescription(description);
    issue.setType(type);
    issue.setSeverity(severity);
    issue.setStatus(status);
    issue.setDetails(details);
    issue.setReportedBy(reportedBy);
    issue.setReportedOn(reportedOn);
    issue.setAssignedTo(assignedTo);
    issue.setEstimatedHours(estimatedHours);
    return issue;
  }

}
